﻿using System;
using System.Threading.Tasks;
using System.Xml;
using SaiLing;
using SaiLing.Domain.Persistence.Relational;

namespace SaiLing.SingleSignOn.Domain.Entities.System
{
    public class Application:IEntity
    {
        public string Name { get; set; }

        public string AppKey { get; set; }

        public string AppSecret { get; set; }

        public string Url { get; set; }

        public string Icon { get; set; }

        public string Remark { get; set; }

        public static Task<string> GenerateKey()
        {
            var key =  UniqueIdGenerator.GetInstance().GetBase32UniqueId(12).ToLower();
            return Task.FromResult<string>(key);
        }

        public static Task<string> GenerateSecret()
        {
            var secret = Guid.NewGuid().ToString().Replace("-", "");
            return Task.FromResult<string>(secret);
        }
    }
}
